/*
rustc --crate-name array --edition=2018 src/array.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=7fb2120ee6eb47b7 -C extra-filename=-7fb2120ee6eb47b7 --out-dir /home/vagrant/proj/rust/mycode/rust_test/target/debug/deps -C incremental=/home/vagrant/proj/rust/mycode/rust_test/target/debug/incremental -L dependency=/home/vagrant/proj/rust/mycode/rust_test/target/debug/deps

https://github.com/rust-lang/rust/pull/68164
*/

#![feature(no_sanitize)]

#[no_sanitize(address)]
fn test_array(index: usize) {
	let mut xs: [usize; 5] = [3, 9999, 0, 0, 0];
    let mut b = xs[0];
    let idx = index + b;
	b += 1;
    xs[index] = b;
    xs[idx] = 7;
	println!("{:?}", xs[index])
}

#[no_sanitize(address)]
fn main() {
    let mut i = 20;
    loop {
        test_array(1);
        i -= 1;
        if i < 0 {
            break;
        }
    }
    
}